export class regex {
    validURL(url) {
        const reg = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
        return reg.test(url)
    }
    validLowerCase(str) {
        const reg = /^[a-z]+$/
        return reg.test(str)
    }
    validUpperCase(str) {
        const reg = /^[A-Z]+$/
        return reg.test(str)
    }
    validAlphabets(str) {
        const reg = /^[A-Za-z]+$/
        return reg.test(str)
    }
    validEmail(email) {
        // eslint-disable-next-line no-useless-escape
        const reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,50}))$/
        return reg.test(email)
    }
    validVerifyCode(code) {
        const reg = /^[a-zA-Z0-9]{6}$/
        return reg.test(code);
    }
    validPwd(pwd) {
        const reg = /^(?![A-Za-z]+$)(?![A-Z0-9]+$)(?![a-z0-9]+$)(?![a-z\\W]+$)(?![A-Z\\W]+$)(?![0-9\\W]+$)[a-zA-Z0-9\\W]{8,16}$/;
        return reg.test(pwd);
    }
}
